// ignore_for_file: file_names, must_be_immutable, constant_identifier_names, slash_for_doc_comments, avoid_unnecessary_containers, prefer_const_constructors, unnecessary_cast, sized_box_for_whitespace, prefer_function_declarations_over_variables, overridden_fields, annotate_overrides, prefer_const_literals_to_create_immutables, unnecessary_null_comparison, deprecated_member_use, prefer_final_fields

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mybase/base/abstract/IFFScaffold.dart';
import 'package:mybase/base/config/AppListTheme.dart';
import 'package:mybase/base/widget/layout/FFImageButton.dart';
import 'package:mybase/base/widget/page/FFScaffold.dart';

/**ListView继承此类 */
class FFListScaffold extends FFScaffold {
  FFListScaffold({
    Key? key,
  }) : super(key: key);

  @override
  FFListScaffoldState createState() => FFListScaffoldState();
}

class FFListScaffoldState extends FFScaffoldState with MFFScaffold {
  ScrollController? scrollController = ScrollController();

  @override
  Widget? ffBody(BuildContext context) {
    Widget? head = ffHeadSliver(context);

    return CustomScrollView(
      controller: scrollController,
      physics: physics,
      slivers: [
        if (head != null) head,
        SliverList(
          delegate: SliverChildBuilderDelegate(
                (BuildContext ctx, int index) {
              return ffItem(ctx, index);
            },
            childCount: ffItemCount(),
          ),
        )
      ],
    );
  }

  /**子类重写以下的方法 */
  /**item */
  Widget ffItem(BuildContext context, int index) {
    return FFImageButton(
      image: null,
      heigth: 40,
      color: Colors.pink,
      margin: EdgeInsets.only(
        bottom: 1,
      ),
    );
  }

  /**数量 */
  int ffItemCount() {
    return datas.length;
  }

  /**头部 */
  Widget? ffHeadSliver(BuildContext context) {}
}
